﻿Imports System.Windows.Forms
Imports Microsoft.Win32

Public Class SystemPaths

    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        If My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\UCS\Ide") IsNot Nothing Then
            Label12.Text = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\UCS\Ide", "LibPath", "")
        End If
        If FolderBrowserDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            Label12.Text = FolderBrowserDialog1.SelectedPath
            If My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\UCS\Ide") IsNot Nothing Then
                My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\UCS\Ide", "LibPath", FolderBrowserDialog1.SelectedPath)
            Else
                Dim newKey As RegistryKey
                newKey = My.Computer.Registry.LocalMachine.CreateSubKey("SOFTWARE\UCS\Ide")
                newKey.SetValue("LibPath", FolderBrowserDialog1.SelectedPath)
            End If
        End If
    End Sub
End Class
